home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin MDIForm frmMain
- Caption = "MDI Background Demo"
- ClientHeight = 5190
- ClientLeft = 1095
- ClientTop = 1770
- ClientWidth = 9165
- Height = 5880
- Left = 1035
- LinkTopic = "MDIForm1"
- Top = 1140
- Width = 9285
- Begin SSPanel pStatus
- Align = 2 'Align Bottom
- BevelInner = 1 'Inset
- Caption = "pStatus"
- Font3D = 3 'Inset w/light shading
- Height = 405
- Left = 0
- TabIndex = 9
- Top = 4785
- Width = 9165
- End
- Begin SSPanel Panel3D1
- Align = 1 'Align Top
- Height = 2025
- Left = 0
- TabIndex = 8
- Top = 0
- Width = 9165
- Begin MsgBlaster MsgBlaster1
- Prop8 = "Click on ""..."" for the About Box ---->"
- Left = 4770
- Top = 990
- End
- Begin PictureBox Picture2
- AutoRedraw = -1 'True
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 2880
- Left = 1410
- Picture = MDIDRAW.FRX:0000
- ScaleHeight = 2880
- ScaleWidth = 3075
- TabIndex = 11
- Top = 990
- Visible = 0 'False
- Width = 3075
- End
- Begin PictureBox Picture1
- AutoRedraw = -1 'True
- AutoSize = -1 'True
- BorderStyle = 0 'None
- Height = 810
- Left = 270
- Picture = MDIDRAW.FRX:4466
- ScaleHeight = 810
- ScaleWidth = 840
- TabIndex = 10
- Top = 990
- Visible = 0 'False
- Width = 840
- End
- Begin OptionButton FocusTrap
- BackColor = &H00C0C0C0&
- Caption = "Option1"
- Height = 255
- Left = 8700
- TabIndex = 0
- Top = 150
- Value = -1 'True
- Width = 225
- End
- Begin CommandButton cButton
- Caption = "Show All"
- Height = 345
- Index = 5
- Left = 6150
- TabIndex = 6
- Tag = "Unhide all ""hidden"" child document forms"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "Vertical"
- Height = 345
- Index = 4
- Left = 4950
- TabIndex = 5
- Tag = "Tile vertically all ""visible"" document child forms"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "Exit"
- Height = 345
- Index = 6
- Left = 7350
- TabIndex = 7
- Tag = "Exit demonstration"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "Horizontal"
- Height = 345
- Index = 3
- Left = 3750
- TabIndex = 4
- Tag = "Tile horizontally all ""visible"" document child forms"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "Cascade"
- Height = 345
- Index = 2
- Left = 2550
- TabIndex = 3
- Tag = "Cascade all ""visible"" child document forms"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "New"
- Height = 345
- Index = 1
- Left = 1350
- TabIndex = 2
- Tag = "Create new instance of document child form"
- Top = 90
- Width = 1215
- End
- Begin CommandButton cButton
- Caption = "Background"
- Height = 345
- Index = 0
- Left = 150
- TabIndex = 1
- Tag = "Toggle between MDI backgrounds"
- Top = 90
- Width = 1215
- End
- End
- Begin Menu mMain
- Caption = "&Parent Menu"
- Begin Menu mTest
- Caption = "E&xit"
- End
- End
- '---------------------------------------------------------------------------
- ' MDI Background Demo Program, Copyright (c) 1994 Karl E. Peterson
- ' Redistributed by permission. CompuServe: 72302,3707
- ' See MDIDEMO.BAS for complete description
- '---------------------------------------------------------------------------
- 'Default behavior
- DefInt A-Z
- Option Explicit
- 'Index into toolbar buttons
- Const bBackground = 0
- Const bNew = 1
- Const bCascade = 2
- Const bHorz = 3
- Const bVert = 4
- Const bShow = 5
- Const bExit = 6
- 'Variable to track current background
- Dim BackStyle%
- Const HiBackStyle = 7
- Sub cButton_Click (Index As Integer)
- FocusTrap.SetFocus
- Select Case Index
- Case bBackground
- 'Increment current background
- BackStyle = BackStyle + 1
- If BackStyle > HiBackStyle Then
- BackStyle = 0
- End If
- MDIForm_Paint
- Case bNew
- mdiNew
- Case bCascade
- mdiArrange WM_MDICASCADE
- Case bHorz
- mdiArrange MDITILE_HORIZONTAL
- Case bVert
- mdiArrange MDITILE_VERTICAL
- Case bShow
- mdiShowAll
- Case bExit
- mdiShowAll
- Unload Me
- End Select
- End Sub
- Sub cButton_MouseMove (Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Update status bar
- DisplayStatus (cButton(Index).Tag)
- End Sub
- Sub MDIForm_Load ()
- 'Position form on screen, use 640x480 as target dims
- Dim newWidth%, newHeight%
- newWidth = 640 * Screen.TwipsPerPixelX
- If Screen.Height > 480 * Screen.TwipsPerPixelY Then
- newHeight = 480 * Screen.TwipsPerPixelY
- Else
- newHeight = .9 * Screen.Height
- End If
- Move (Screen.Width - newWidth) \ 2, (Screen.Height - newHeight) \ 2, newWidth, newHeight
- 'Position/Resize toolbar panel
- Panel3D1.Height = 2 * cButton(0).Top + cButton(0).Height
- FocusTrap.Move FocusTrap.Width * -3
- 'Set up child arrays
- ReDim fDoc(1) 'array of child forms
- ReDim fState(1) 'array to track child state
- 'Create first child and clear status bar
- mdiNew
- DisplayStatus ""
- 'Setup MsgBlast control
- MsgBlaster1.hWndTarget = (GetWindow(Me.hWnd, GW_CHILD))
- MsgBlaster1.MsgList(0) = WM_PAINT
- MsgBlaster1.MsgPassage(0) = MB_PREPROCESS
- MsgBlaster1.MsgList(1) = WM_ERASEBKGND
- MsgBlaster1.MsgPassage(1) = MB_EATMESSAGE
- End Sub
- Sub MDIForm_Paint ()
- 'Our substitute Paint event (since VB doesn't give us one)
- Select Case BackStyle
- Case 0
- mdiPaintSolid (Me.hWnd), &H400000
- mdiTextOut (Me.hWnd), " Solid Fill ", 10, 10
- Case 1
- mdiBitBltTiled (Picture1.hWnd), (Picture1.hDC), (Me.hWnd)
- mdiTextOut (Me.hWnd), " Tiled Pattern ", 10, 10
- Case 2
- mdiPaintGradiant (Me.hWnd)
- mdiTextOut (Me.hWnd), " Gradiant Fill, Style 1 ", 10, 10
- Case 3
- DoEvents
- mdiPaintTunnel1 (Me.hWnd)
- mdiTextOut (Me.hWnd), " Gradiant Fill, Style 2 ", 10, 10
- Case 4
- DoEvents
- mdiPaintTunnel2 (Me.hWnd)
- mdiTextOut (Me.hWnd), " Gradiant Fill, Style 3 ", 10, 10
- Case 5
- mdiPaintSolid (Me.hWnd), 0&
- mdiBitBltCentered (Picture2.hWnd), (Picture2.hDC), (Me.hWnd)
- mdiTextOut (Me.hWnd), " Centered Bitmap ", 10, 10
- Case 6
- mdiPaintSolid (Me.hWnd), 0&
- mdiStretchBlt (Picture2.hWnd), (Picture2.hDC), (Me.hWnd), True
- mdiTextOut (Me.hWnd), " Stretched (Proportionally) Bitmap ", 10, 10
- Case 7
- mdiStretchBlt (Picture2.hWnd), (Picture2.hDC), (Me.hWnd), False
- mdiTextOut (Me.hWnd), " Stretched (Non-Proportionally) Bitmap ", 10, 10
- End Select
- End Sub
- Sub MDIForm_Resize ()
- Static LastState%, LastWidth%, LastHeight%
- If LastState = MAXIMIZED Then
- 'ensure a repaint (doesn't always happen)
- MDIForm_Paint
- End If
- If Me.WindowState <> MINIMIZED Then
- 'rearrange icons
- 'mdiArrange WM_MDIICONARRANGE
- End If
- 'Ensure a repaint if window was made smaller
- If Me.Width < LastWidth Or Me.Height < LastHeight Then
- MDIForm_Paint
- End If
- 'Store new size
- LastState = WindowState
- LastWidth = Me.Width
- LastHeight = Me.Height
- End Sub
- Sub MDIForm_Unload (Cancel As Integer)
- Dim i%
- For i = Forms.Count - 1 To 0 Step -1
- If Forms(i) Is Me Then
- 'do nothing
- Else
- Unload Forms(i)
- End If
- Next i
- End Sub
- Sub MsgBlaster1_Message (MsgVal As Integer, wParam As Integer, lParam As Long, ReturnVal As Long)
- 'The heart and soul of the whole enchilada!
- '(sorry about the mixed metaphor<g>)
- Select Case MsgVal
- Case WM_PAINT
- MDIForm_Paint
- Case WM_ERASEBKGND
- 'Eat it!
- End Select
- End Sub
- Sub mTest_Click ()
- Unload Me
- End Sub
- Sub Panel3D1_MouseMove (Button As Integer, Shift As Integer, X As Single, Y As Single)
- 'Update status bar
- DisplayStatus ""
- End Sub
-